﻿// /////////////////////////////////// 
//  
//  
//      WiseLink CCF2.0 
//     (c)Copyright 2001-2010 WiseLink Xiaojun (David) Chen 
//        Authored and Owned Xiaojun (David) Chen 
//        All Right Reserved
//  
// /////////////////////////////////// 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infrastructure.Log;

namespace ZICModel.Fault
{
    public class BodyHandler
    {
        private FaultBase currentFault;

        public BodyHandler(FaultBase fault)
        {
            currentFault = fault;
            currentFault.FaultBody = new Body();
        }

        public void Process()
        {
            int start = 0;
            string faultString = currentFault.OriginalFault.PropertyData.Substring(8);
            while (start < currentFault.FaultHeader.MainFaultCount)
            {
                MainFaultDetail mainFaultDetail = new MainFaultDetail(faultString);
                faultString = mainFaultDetail.Process();
                currentFault.FaultBody.ZISMainFaultList.Add(mainFaultDetail);
                start++;
            }
            CallLogger.LogMessage(typeof(BodyHandler), "******* The end of process ZIS message ************** \r\n  ");
        }
    }
}
